package com.hon.legionnaire.negocio.vo;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "servico")
@SequenceGenerator(name = "servico_seq", sequenceName = "servico_cod_servico_seq", allocationSize = 1)
@NamedQueries ({
	@NamedQuery(name = "loadAllServico", query = "from ServicoVO"),
	@NamedQuery(name = "findServico", query = "from ServicoVO as s where s.codigo = :codigo"),
	@NamedQuery(name = "findDuplicatedServico", query = "from ServicoVO as s where s.descricao = :descricao and s.codigo != :codigo")
})
public class ServicoVO implements Serializable {

	private static final long serialVersionUID = 1L;
	
	@Id
	@Column(name = "cod_servico")
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "servico_seq")
	private int codigo;
	
	@Column(name = "descricao", length = 30, unique = true)
	private String descricao;	
	
	@Column(name = "preco")
	private Float preco;
	
	@Column (name = "comentario", length = 200)
	private String comentario;
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column (name = "data_criacao")
	private Date dataCriacao;
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column (name = "data_alteracao")
	private Date dataAlteracao;
	
	public Date getDataCriacao() {
		return dataCriacao;
	}

	public void setDataCriacao(Date dataCriacao) {
		this.dataCriacao = dataCriacao;
	}

	public Date getDataAlteracao() {
		return dataAlteracao;
	}

	public void setDataAlteracao(Date dataAlteracao) {
		this.dataAlteracao = dataAlteracao;
	}

	public ServicoVO() {
		
	}
	
	public ServicoVO(int codigo, String descricao) {
		this.codigo = codigo;
		this.descricao = descricao;
	}

	public int getCodigo() {
		return codigo;
	}

	public void setCodigo(int codigo) {
		this.codigo = codigo;
	}

	public String getDescricao() {
		return descricao;
	}

	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}

	public void setPreco(Float preco) {
		this.preco = preco;
	}

	public Float getPreco() {
		return preco;
	}

	public void setComentario(String comentario) {
		this.comentario = comentario;
	}

	public String getComentario() {
		return comentario;
	}

}